using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BookingDB.Models.Mapping
{
    public class EmployeeMap : EntityTypeConfiguration<EntityEmployee>
    {
        public EmployeeMap()
        {
            // Primary Key
            this.HasKey(t => t.emp_Id);

            // Properties
            this.Property(t => t.emp_Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.title)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Employee");
            this.Property(t => t.emp_Id).HasColumnName("emp_Id");
            this.Property(t => t.title).HasColumnName("title");

            // Relationships
            this.HasRequired(t => t.Person)
                .WithOptional(t => t.Employee);

        }
    }
}
